package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Tel string `gorm:"type:char(11);not null"`
}
type RealName struct {
	gorm.Model
	Username string `gorm:"type:varchar(30);not null"`
	IdCard   string `gorm:"type:char(18);not null"`
	UserId   int64  `gorm:"type:int(11);not null"`
}

func (r *RealName) Create() error {
	return DB.Create(&r).Error
}
func (r *RealName) GetRealName(UserId int64, IdCard string) error {
	return DB.Where("user_id = ? or id_card = ?", UserId, IdCard).Limit(1).Find(&r).Error
}
